import request from '@/utils/request'

// 获取订单列表
export function getOrderList(params) {
  return request({
    url: '/order/list',
    method: 'get',
    params
  })
}

// 根据ID获取订单详情
export function getOrderById(id) {
  return request({
    url: `/order/${id}`,
    method: 'get'
  })
}

// 创建订单
export function addOrder(data) {
  return request({
    url: '/order',
    method: 'post',
    data
  })
}

// 更新订单
export function updateOrder(id, data) {
  return request({
    url: `/order/${id}`,
    method: 'put',
    data
  })
}

// 删除订单
export function deleteOrder(id) {
  return request({
    url: `/order/${id}`,
    method: 'delete'
  })
}

// 批量删除订单
export function batchDeleteOrders(ids) {
  return request({
    url: '/order/batch',
    method: 'delete',
    data: ids
  })
}

// 更新订单状态
export function updateOrderStatus(id, status) {
  return request({
    url: `/order/${id}/status`,
    method: 'patch',
    params: { orderStatus: status }
  })
}

